package com.heima.user.controller;

import com.heima.model.common.constants.admin.AdminConstants;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.user.dtos.AuthDTO;
import com.heima.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/auth")
public class ApUserRealnameController {
    @Autowired
    ApUserRealnameService apUserRealnameServicer;

    @PostMapping("/list")
    ResponseResult list(@RequestBody AuthDTO dto){
        return apUserRealnameServicer.list(dto);

    }
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDTO DTO) {
        return apUserRealnameServicer.updateStatusById(DTO, AdminConstants.PASS_AUTH);
    }

    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDTO DTO) {
        return apUserRealnameServicer.updateStatusById(DTO, AdminConstants.FAIL_AUTH);
    }
}
